var arr = [9, 6, 15, 4, 2];
function quickSort(arr){
    if(arr.length < 1){return arr;}
    var index = Math.floor(arr.length/2);
    var point = arr.splice(index, 1);
    var left = [], right = [];
    for(var i=0;i<arr.length;i++){
        if(arr[i]<point){
            left.push(arr[i])
        }else{
            right.push(arr[i])
        }
    }
    return quickSort(left).concat(point,quickSort(right));
}
console.log(quickSort(arr))

const str = 'jshdjsihh';
const obj = str.split('').reduce((pre,item) => {
    console.log(pre,item)
    pre[item] ? pre[item] ++ : pre[item] = 1
    return pre
},{})
 console.log(obj) // {j: 2, s: 2, h: 3, d: 1, i: 1}